﻿using Microsoft.AspNetCore.Mvc;
using mvc.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace mvc.Controllers
{
    public class LoginController : Controller
    {
        [ViewData]
        public string Title { get; set; }

        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Login(LoginViewModel model)
        {
            Title = "login user page";

            ViewData["email"] = model.Email;
            ViewData["password"] = model.Password;

            ViewData["loginUser"] = new LoginViewModel() { 
                Email = model.Email, Password = model.Password};

            // 这里model的数据放到了View中的Model
            return View("Login",model);
        }
    }
}
